package com.yunji.storage.enums;

import java.util.Objects;

public enum StorageBusinessType {

    OTTER_BUSINESS(9, "其他"),
    ALLOCATE_BUSINESS(1, "调拨"),
    REPAIR_BUSINESS(2, "坏返"),
    FIX_BUSINESS(3, "维修单"),
    STOCKTAKE_BUSINESS(4, "盘点"),
    PRODUCE_BUSINESS(5, "生产"),
    PURCHASE_BUSINESS(6, "采购"),
    RETURN_BUSINESS(7, "退货"),
    DISCARD_BUSINESS(8, "废品"),
    SALES_BUSINESS(11, "销售"),
    OPERATE_BUSINESS(12, "员工操作");
    private final Integer code;
    private final String text;

    StorageBusinessType(Integer code, String text) {
        this.code = code;
        this.text = text;
    }

    public Integer getCode() {
        return code;
    }

    public String getText() {
        return text;
    }


    public static String get(Integer code) {
        StorageBusinessType[] enums = StorageBusinessType.values();
        for (StorageBusinessType e : enums) {
            if (Objects.equals(e.code, code)) {
                return e.text;
            }
        }
        return null;
    }
}
